package core.bmp;

import core.bmp.model.BmpData;
import core.bmp.model.Pixel;
import core.bmp.utils.PixelUtil;

public abstract class AbsPixWorker extends AbsWorker {

	/* 继承 */

	@Override
	public final void onWork(BmpData bmpData) {
		int[] argb = bmpData.getArgbPix();
		Pixel pix;
		for (int i = 0, len = argb.length; i < len; i++) {
			// 方法形参无法来回传递原始数据，因而这里封装成对象传递引用
			pix = PixelUtil.intToPixel(argb[i]);
			handlerPix(pix);
			argb[i] = PixelUtil.pixelToInt(pix);
		}
	}

	/* 内部回调 */

	public abstract void handlerPix(Pixel pixel);

}
